Skip to content

feat: add modules.contentControls.chrome#3486

Merged
caio-pizzol merged 8 commits into
mainfrom
artem/SD-3159
May 28, 2026
Merged

feat: add modules.contentControls.chrome#3486
caio-pizzol merged 8 commits into
mainfrom
artem/SD-3159

Conversation

@artem-harbour
Copy link
Copy Markdown
Contributor

@artem-harbour artem-harbour commented May 25, 2026

Linear: SD-3159

Introduces modules.contentControls.chrome ('default' | 'none') to let consumers disable built-in content-control chrome while preserving SDT data, wrappers, and geometry APIs.

What changed:

  • Added public config surface in SuperDoc types (modules.contentControls.chrome).
  • Threaded the option through SuperDoc.vueLayoutEngineOptionsPresentationEditorDomPainter.
  • Implemented painter behavior for chrome: 'none':
    • mount-level class toggle: superdoc-cc-chrome-none
    • inline SDT label non-emission (createInlineSdtWrapper)
    • block/table label non-emission via applySdtContainerStyling(..., chrome) across all paths, including nested tables.
  • Kept documentSection tooltip behavior unchanged (suppression applies only to structured content/content controls).
  • Added/updated tests for inline/block suppression, virtualization remount behavior, and chrome-none style selectors.

@artem-harbour artem-harbour self-assigned this May 25, 2026
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 25, 2026

SD-3159

@github-actions
Copy link
Copy Markdown
Contributor

📖 Docs preview: https://superdoc-artem-sd-3159.mintlify.app

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@artem-harbour artem-harbour requested a review from caio-pizzol May 25, 2026 16:10
@artem-harbour artem-harbour marked this pull request as ready for review May 25, 2026 16:19
@artem-harbour artem-harbour requested a review from a team as a code owner May 25, 2026 16:19
@artem-harbour artem-harbour requested a review from harbournick May 26, 2026 09:58
@artem-harbour
Copy link
Copy Markdown
Contributor Author

@artem-harbour, @caio-pizzol - fixed conflicts. Can you please review?

Resolve conflicts in painters/dom/src/styles.ts and index.test.ts.

main refactored block SDT chrome to ::before (background) / ::after
(border) pseudo-elements after this branch forked. The branch's
chrome-none opt-out only targeted element-level selectors, which cannot
override pseudo-element paint, so block chrome (hover fill, selected
blue border, lock-hover fill) leaked under contentControlsChrome=none.

Add .superdoc-cc-chrome-none suppression for the block pseudo-elements,
including the selected-node ::after border and the lock-hover ::before
background, declared after every chrome-showing pseudo rule so source
order resolves equal-specificity ties (matching the viewing-mode rules).

index.test.ts: keep both sides' added tests (the branch's three
chrome-none tests and main's block-chrome-width/image/empty-SDT tests).
styles.test.ts: assert the new pseudo-element suppression selectors.
… visuals

Set modules.contentControls.chrome: 'none' so the demo shows the
intended SD-3159 use case: built-in SDT chrome off, host owns the
visuals. Smart-field pills and clause cards are now host-painted under
.superdoc-cc-chrome-none (scoped so they sit above the painter's reset),
and the painter-label CSS is dropped since no label element is emitted.
The contextual field chip is unchanged and still anchors via getRect,
which keeps working because wrappers and data-sdt-* datasets are kept.
…rder

Cover the :hover ::before/::after suppression selectors and add an
order assertion: the chrome-none block must be declared after the
lock-hover ::before rule. Those hover selectors are equal specificity
to the rules they override, so source order is what makes them win;
the assertion guards against a future reorder silently re-leaking
hover chrome under contentControlsChrome=none.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 22 files

Re-trigger cubic

Second integration of main, which advanced into the same SDT-chrome
area right after the prior merge. main moved the block SDT fill onto
the ::before chrome layer (behind content) instead of the wrapper
element. The chrome-none suppression already neutralizes ::before
background at the base selector, so the relocated fill is covered;
verified in-browser that block fill, border, hover, selection and
lock-hover stay suppressed under contentControlsChrome=none.

Only index.test.ts conflicted (interleaved new image/empty-SDT tests
with the chrome-none tests); kept both sides.
Close review-feedback coverage gaps for modules.contentControls.chrome:
- SuperDoc.test.js: assert SuperDoc.vue forwards
  modules.contentControls.chrome into the PresentationEditor layout
  options (and stays undefined when unset). This is the public consumer
  path; DomPainter unit tests exercised the option but not the wiring.
- consumer-typecheck: pin that modules.contentControls.chrome: 'none'
  compiles for a consumer across the tsconfig matrix.
- table tests: assert chrome: 'none' suppresses the label but keeps the
  wrapper for a table-level SDT and a nested-table SDT in a cell; the
  threading through fragment/row/cell had no coverage.
- virtualization.test.ts: restore the page-0 eviction assertion that the
  PR had dropped, so the remount test again proves eviction happened
  first (verified it still passes).
- styles.ts: scope the chrome-opt-out comment to structured-content
  labels; documentSection chrome is intentionally preserved.
contentControls has a single real runtime option: SuperDoc.vue reads
modules.contentControls.chrome and forwards nothing else. The
& Record<string, unknown> intersection (mirrored from sibling module
configs that genuinely forward extra keys) gave no typo safety for the
new public option, and made the consumer fixture pin a pass-through
contract that does not exist. Drop the index signature and the fixture's
forwardedFlag so an unknown contentControls key is now a compile error.
The header claimed every modules.X shape is intentionally open. That is
now false: configs that forward runtime extras stay open, but
contentControls (one real option, no forwarding) is intentionally exact.
Reword so the file documents both policies. Comment-only.
Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @artem-harbour, thanks for the updates.

i pushed a few follow-up commits to finish the chrome-none work, add missing coverage, and tighten the public config type.

lgtm once CI is green.

@caio-pizzol caio-pizzol enabled auto-merge May 28, 2026 22:27
@caio-pizzol caio-pizzol merged commit b1431d9 into main May 28, 2026
74 checks passed
@caio-pizzol caio-pizzol deleted the artem/SD-3159 branch May 28, 2026 22:45
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in superdoc-cli v0.15.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in superdoc-sdk v1.14.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.10.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in superdoc v1.38.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in @superdoc-dev/react v1.9.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 29, 2026

🎉 This PR is included in vscode-ext v2.10.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants